using System;
using System.Collections.Generic;
using System.Security.Permissions;
using System.Data;
using Microsoft.Dynamics.Framework.Reports;
public partial class PaletteBuilder
{
    [DataMethod(), AxSessionPermission(SecurityAction.Assert)]
    public static System.Data.DataTable GetPalette()
    {
        return SampleCodeReportLibrary.SampleCode.GetDefaultPalette();
    }

    public static double clip(double v)
    {
        return System.Math.Min(1.0, System.Math.Max(0, v));
    }
    [DataMethod(), AxSessionPermission(SecurityAction.Assert)]
    public static string GetColorVariant(string inputcolor, double v_delta)
    {
        var c = System.Drawing.ColorTranslator.FromHtml(inputcolor);
        var c0 = new SampleCodeReportLibrary.ColorRGB24Bit(c);
        var c1 = c0.ToRGB();
        var c2 = c1.ToHSV();
        var c3 = c2;
        c3.V = clip(c3.V + v_delta);
        var c4 = c3.ToRGB();
        var c5 = c4.ToRGB24Bit();
        var c6 = c5.ToSystemDrawingColor();
        
        return System.Drawing.ColorTranslator.ToHtml(c6);
    }
}
